from math import sqrt


class ParamsTypeError(Exception):
    pass


def add(x, y):  # 加法操作
    return x + y


def my_min(x, y):  # 减法操作
    return x - y


def mul(x, y):  # 乘法操作
    return x * y


def div(x, y):  # 除法操作
    return x / y


def exact_div(x, y):  # 整除操作
    return x // y


def my_remainder(x, y):  # 取余操作
    return x % y


def my_power(x, y):  # 幂操作
    return x ** y


def my_sqr(x):  # 开方操作
    return sqrt(x)


def select_result(x):
    if x == 1:
        print(f'结果:{add(my_input1, my_input2)}')
    elif x == 2:
        print(f'结果:{my_min(my_input1, my_input2)}')
    elif x == 3:
        print(f'结果:{mul(my_input1, my_input2)}')
    elif x == 4:
        print(f'结果:{div(my_input1, my_input2)}')
    elif x == 5:
        print(f'结果:{exact_div(my_input1, my_input2)}')
    elif x == 6:
        print(f'结果:{my_remainder(my_input1, my_input2)}')
    elif x == 7:
        print(f'结果:{my_power(my_input1, my_input2)}')
    elif x == 8:
        print(f'结果:{my_sqr(my_input1)}')


if __name__ == '__main__':
    try:
        my_select_result = int(input("请输入数字选择你需要进行的计算类型: 1.加法;2.减法;3.乘法;4.除法;5.整除;6.取余;7.幂;8.开方:\n"))
        my_input1 = int(input("请输入第一个数:"))
        if my_select_result != 8:
            my_input2 = int(input("请输入第二个数:"))
        select_result(my_select_result)
    except Exception as e:
        raise ParamsTypeError("类型不对,请输入正确的类型")
